from __future__ import division, print_function
import time

from visual import *

boxes = []

#L = 6
#N = 20
L = 6
N = 6
scene.range = L

for x in range(N):
  for y in range(N):
    for z in range(N):
        b = box(color=(x/N,y/N,z/N), 
                pos=(L*(x/(N-1)-.5),L*(y/(N-1)-.5),L*(z/(N-1)-.5)), 
                size=(.6*L/N,.4*L/N,.6*L/N))
        boxes.append(b)

counter = 0
ts = time.time()
t = 0
dt = 0.01
while True:
    counter += 1
    print('Frame Rate = ', counter / (time.time() - ts))
    t += dt
    for box in boxes:
        box.rotate(angle=dt, axis=(0,1,0))
        #boxes[i].axis = ( sin(t), 0, cos(t) )
